<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('商户模板费率列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input type="hidden" name="isShow" value="1"/>
                    <input type="hidden" name="modelType" value="1"/>
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px;">模板编号：</label>
                                <input type="text" name="modelNo"/>
                            </li>
                            <li>
                                <label style="width: 100px;">模板名称：</label>
                                <input type="text" name="modelName"/>
                            </li>
                            <li>
                                <label style="width: 10px;"></label>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('merchant:MerchantModel:edit')}]];
        var removeFlag = [[${@permission.hasPermi('merchant:MerchantModel:remove')}]];
        var modelTypeDatas = [[${@dict.getType('modelType')}]];
        var isShowDatas = [[${@dict.getType('modelType')}]];
        var isDefaultDatas = [[${@dict.getType('isDefault')}]];
        var prefix = ctx + "merchant/merchantModel";

        $(function() {
            var options = {
                url: prefix + "/modelAgentList",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "商户模板费率",
                queryParams:queryParams,
                clickToSelect:true,
                columns: [{
                    radio: true
                },
                {
                    field: 'id',
                    title: '主键编号',
                    visible: false
                },
                {
                    field: 'modelNo',
                    title: '模板编号',
                    align: 'center'
                },
                {
                    field: 'modelName',
                    title: '模板名称',
                    align: 'center'
                },
                /*{
                    field: 'modelType',
                    title: '模板类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(modelTypeDatas, value);
                    },
                    align: 'center'
                },*/
                {
                    field: 'rateValue',
                    title: '费率值描述',
                    align: 'center'
                },
               ]
            };
            $.table.init(options);
        });

        /**
         * 默认参数
         */
        function queryParams(params) {
            var search = $.table.queryParams(params);
            search.isShow = $("input[name='isShow']").val();
            search.modelType = $("input[name='modelType']").val();
            return search;
        }


        function submitHandler(index, layero) {
            var modelNo = $.table.selectColumns("modelNo");
            var modelName = $.table.selectColumns("modelName");

            if (modelNo.length == 0) {
                $.modal.alertWarning("请至少选择一个模版");
                return;
            }
            $.modal.close();
            //修改父页面值
            parent.$("#fjArMark").val(modelNo);
            parent.$("#fjArMarkName").val(modelName);

        }

    </script>
</body>
</html>